﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;

namespace WindowsFormsApplication1
{
    public partial class Item_Popup : Form
    {
        public Item_Popup()
        {
            InitializeComponent();
        }

        private void Item_Popup_Load(object sender, EventArgs e)
        {
            try
            {
                DbConnet.connect(new Log().getConstr());

                String getItems = "SELECT Itemcode,itemname FROM Items ";
                SqlDataReader itdr = DbConnet.ReadTable(getItems);

                while (itdr.Read())
                {
                    String itm = itdr["Itemcode"].ToString() + " - " + itdr["itemname"].ToString();
                    listBox1.Items.Add(itm);
                }
                itdr.Close();
            }
            catch (Exception exitlo)
            {
            }
        }

        private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try
            {
                String val = listBox1.SelectedItem.ToString();
                new Midval().setItemName(val);
                this.Hide();
            }
            catch
            {
            }
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Hide();
        }
    }
}
